package com.aixx.spingcloud.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * 加入容器中
 * @author shkstart
 * @create 2021-01-26 0:28
 */
@Configuration
public class ApplicationContextConfig {
//使用@LoadBalanced注解赋予RestTemplate负载均衡的能力
    @Bean
    @LoadBalanced
    public RestTemplate getRestTemplate(){
       return new RestTemplate();
   }
}
